package com.Lubaichen.Wiki.config;

import com.Lubaichen.Wiki.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author Lubaichen
 * @date 2022年03月08日 22:12
 */
@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {
    @Resource
    LoginInterceptor logInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(logInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns(
                "/test/**",
                "/redis/**",
                "/user/login",
                "/category/all",
                "/ebook/list",
                "/doc/all/**",
                "/doc/find-content/**",
                "/about",
                        "/doc/vote/**",
                        "/ebook-snapshot/**"
        );
    }
}
